package com.meaningful.design_pattern.composite_pattern;

public class Main {

    public static void main(String[] args) {
        Province hlj = new Province("黑龙江");

        City herbin = new City("哈尔滨");
        District nangang = new District("南岗区", 1_390_679);
        District daowai = new District("道外区", 811_178);
        District pingfang = new District("平房区", 238_945);
        herbin.addDistrict(nangang);
        herbin.addDistrict(daowai);
        herbin.addDistrict(pingfang);

        City jms = new City("佳木斯");
        District xiangyang = new District("向阳区", 291_234);
        District jiao = new District("郊区", 263_514);
        jms.addDistrict(xiangyang);
        jms.addDistrict(jiao);

        hlj.addCity(herbin);
        hlj.addCity(jms);

        System.out.println("黑龙江的人口" + hlj.computePopulation());
        System.out.println("哈尔滨的人口" + herbin.computePopulation());
    }

}
